<tagLib name="html" />
<include file="Public:header" />
<div id="main" class="main" >
<!-- 主体内容  -->
<div class="content" >
  
<!--  功能组区域  -->
<div class="btn-toolbar">
      <div class="btn-group">
        <button class="btn btn-primary" onclick="add({$_GET.enter_id})"><i class="icon-plus icon-white"></i> 新增</button>
        <button class="btn btn-primary" onclick="edit()"><i class="icon-edit icon-white"></i> 编辑</button>
        <button class="btn btn-primary" onclick="foreverdel()"><i class="icon-trash icon-white"></i> 删除</button>
      </div>
      <span class="label label-success">总金额：{$sum_overview.sum_total}  总数量：{$sum_overview.sum_number} </span>
      <form class="search-form" method='get' action="__URL__">
        入库时间从<input type="text" class="span2"  name="start_time" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="<notempty name='_REQUEST.start_time'>{$_REQUEST.start_time}</notempty>">
          到<input type="text" class="span2" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" name="end_time" id="end_time" value="<notempty name='_REQUEST.end_time'>{$_REQUEST.end_time}</notempty>" >
          {:modList('Supplier',$_REQUEST['supplier_id'])}
          采购单号  <input type="text" name="buy_no" class="span2" value="{$_REQUEST.buy_no}" />
              <input type="text" class="search-query span4" name="keywords" <notempty name='_REQUEST.keywords'>
                    <php>echo 'value="'.urldecode($_REQUEST['keywords']).'"'</php><else/>
                    placeholder="按产品名称搜索,支持空格多个检索"
                </notempty>
                >
                <input type="submit" class="btn btn-primary" value="搜索">
      </form>
  <notempty name="_REQUEST.buy_id">
    <php>
      $eid = $_REQUEST['buy_id'];
      $enter = M('Buy');
      $enter->getById($eid);
      $total_number = M('Buy_detail')->where('buy_id = '.$eid)->sum('number');
      $buy_no = $enter->buy_no;
      $total = $enter->total;
      $supplier = $enter->supplier_id;
      $user_id = $enter->user_id;
      $create_time = $enter->create_time;

      
    </php>
  <p class="h4 span12 alert-info alert"><strong>采购单号:</strong> {$buy_no}  <strong>总数量</strong>: {$total_number}  <strong>总金额：</strong>{$total}元   <strong>供应商:</strong>{$supplier|getModelName="Supplier"}    <strong>经办人：</strong>{$user_id|getModelName="User"}    <strong>采购时间:</strong>{$create_time|toDate}
  </p> 
  </notempty>
  </div>
<!-- 功能组区域结束 -->
<php>
    function getUser($enter_id){
        return getModelName($enter_id,'User');
    }
</php>
<!-- 列表显示区域  -->
<div class="list" style="display:table;">
<div id="result" class="result none"></div>

<html:list id="checkList" pk="did" style="table table-bordered table-striped" name="action" checkbox="true" action="true" datasource="list" show="id:编号|3%:edit,buy_no:入库单号,product_id|getModelName=Product:产品,enter_price:进价,number:采购数量,total:采购总金额,receive_number:实收数量,receive_total:实收总金额,finish|getFinishStatus:入库结束,supplier_id|getModelName=Supplier:供应商,create_time|toDate:入库时间" actionlist="edit:编辑:id" />
</div>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>
<!-- 主页面结束 -->
<include file="Public:footer"/>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />
